package com.why.serviceedu.controller.front;

import com.why.commonresults.Result;
import com.why.serviceedu.bean.EduCourse;
import com.why.serviceedu.service.EduCourseService;
import com.why.serviceedu.bean.EduTeacher;
import com.why.serviceedu.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: guli_parent
 * @description:
 * @author: @why
 * @create: 2021-02-14 18:06
 **/
@RestController
@RequestMapping("/eduservice/")
@CrossOrigin
public class FrontIndexController {
    @Autowired
    private EduTeacherService teacherService;
    @Autowired
    private EduCourseService courseService;

    /**
     * 查询8个热门课程，4个热门讲师  展览
     */

    @GetMapping("/frontEndExhibition")
    public Result frontEndExhibition() {
        List<EduTeacher> teachers = teacherService.getHighTeacher();
        List<EduCourse> courses = courseService.getHotCourse();


        return Result.ok().data("teachers", teachers).data("courses", courses);
    }


}
